<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Star {
            constructor(uname, age){
                this.uname = uname;
                this.age = age;
            }
            sing(song){
                console.log(this.uname + song);
            }
        }
        // 1.类里面的函数不需要写 function
        // 2.对函数之间不需要
        var eason = new Star('陈奕迅', 18);
        var jay = new Star('周杰伦', 22);
        console.log(eason);
        console.log(jay);
        eason.sing('因为爱情');
        eason.play("足球");
        jay.sing('轨迹');
        jay.play('跑车');
    </script>
</body>
</html>